<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=building-width, initial-scale=1, maximum-scale=1">
    <% include("/templates/common/header.html"){} %>
</head>
<body>
<!-- 布局容器 -->
<div class="layui-layout layui-layout-admin">
    <!-- 头部 -->
    <div class="layui-header">
        <div class="layui-main">
            <div class="top-left">
                <!-- logo -->
                <a href="javascript:;" class="logo">母婴信息系统后台管理</a>
                <a href="javascript:;" class="menu-flexible ml10">
                    <i class="layui-icon">&#xe635;</i>
                </a>
            </div>
            <!-- 头部右侧操作 -->
            <ul class="layui-nav operate">
                <li class="layui-nav-item">
                    <a href="javascript:;">${session.cUser.username!}</a>
                    <dl class="layui-nav-child">
                        <dd>
                            <a href="javascript:;" class="edit-password">修改密码</a>
                        </dd>
                        <dd>
                            <a href="${ctxPath!}/sys/logout.html">退出登录</a>
                        </dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>

    <!-- 左侧菜单 -->
    <div class="layui-side layui-bg-black left-menu-all ">
        <div class="layui-side-scroll">
            <ul class="layui-nav layui-nav-tree left-menu" lay-filter="left-menu">
                <li class="layui-nav-item layui-this">
                    <a href="javascript:;" data-url="${ctxPath!}/console/index" data-id="-1">后台首页</a>
                </li>
                <%
                for(menu in menuList){
                %>
                <li class="layui-nav-item">
                    <a href="javascript:;" data-url="${ctxPath!}${menu.url!}" data-id="${menu.id!}">${menu.name!}</a>
                    <%
                    if(isNotEmpty(menu.subPerms)){
                    %>
                    <%
                    for(subMenu in menu.subPerms){
                    %>
                    <dl class="layui-nav-child">
                        <dd>
                            <a href="javascript:;" data-url="${ctxPath!}${subMenu.url!}" data-id="${subMenu.id!}">${subMenu.name!}</a>
                        </dd>
                    </dl>
                    <%
                    }
                    %>
                    <%
                    }
                    %>
                </li>
                <%
                }
                %>

            </ul>
        </div>
    </div>

    <!-- 主体 -->
    <div class="layui-body">
        <!-- 顶部切换卡 -->
        <div class="layui-tab layui-tab-card" lay-filter="top-tab" lay-allowClose="true">
            <ul class="layui-tab-title"></ul>
            <div class="layui-tab-button">
                <a href="javascript:;"><i class="layui-icon">&#x1002;</i></a>
            </div>
            <div class="layui-tab-content"></div>
        </div>
    </div>

    <!-- 底部 -->
    <div class="layui-footer">
        &copy; 2018 SCAU Big Data. All Rights Reserved
    </div>
</div>

<script type="text/javascript" src="/js/admin.js"></script>
<script>
    layui.use(['jquery','form','layer'], function(){
        var $ = layui.jquery,
            layer = layui.layer;

        // 修改密码
        $(document).on("click", ".edit-password", function() {
            layer.open({
                type:2
                ,area:['450px', '330px']
                ,title:"修改密码"
                ,content: '/sys/user/editPw'
            });
        });
    });
    function timestampToTime(timestamp) {
        var date = new Date(timestamp);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
        Y = date.getFullYear() + '-';
        M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
        D = date.getDate()<10?('0'+date.getDate()):(date.getDate())+ ' ';
        h = date.getHours()<10?('0'+date.getHours()):(date.getHours()) + ':';
        m = date.getMinutes()<10?('0'+date.getMinutes()):(date.getMinutes()) + ':';
        s = date.getSeconds()<10?('0'+date.getSeconds()):(date.getSeconds());
        return Y+M+D;
    }

</script>
</body>
</html>